package org.benjamin.lending.controller;

import org.benjamin.lending.domain.entity.RechargeLog;
import org.benjamin.lending.domain.form.RechargeForm;
import org.benjamin.lending.service.RechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "manager/recharge")
public class ManagerRechargeController {
	
	@Autowired
	private RechargeService rechargeService;
	
	@RequestMapping(value = "index")
	public ModelAndView index(@ModelAttribute("rechargeForm") RechargeForm rechargeForm,Pageable pageable) {
		ModelAndView modelAndView = new ModelAndView("admin.recharge.index");
		Page<RechargeLog> rechargeLogs = this.rechargeService.findRechargeLogPage(rechargeForm, pageable);
		modelAndView.addObject("rechargeLogs",rechargeLogs);
		return modelAndView;
	}

}
